;;;
;;;
;;;	Author:
;;;		Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;
;;;	http://www.paracadd.com
;;;	All rights reserved.
;;;
;;;	Revised 11/10/2012	Modified message text and changed message output from command line to alert box
(defun c:vstat ()
  (setq msg "Viewport Information:")
  (setq curvno (getvar"cvport"))
  (setq vtwang (getvar"viewtwist"))
;;;  (regapp "ACAD")
  (if chkctabname NIL (LOAD "chkctabname" "\nFile CHKCTABNAME.LSP not loaded! "))
  (chkctabname)
  (setq cvpss (ssget "X" (list(cons 69 curvno)(cons 410 ctab-name))))
  (setq cvpent (entget (ssname cvpss 0)(list "ACAD")))
  (setq vpscl (/(getvar"viewsize")(cdr(assoc 41 cvpent))))
  (setq xvdata (cadr(assoc -3 cvpent)))
  (setq hvplot (cdr(nth 28 xvdata)))
  (if (= hvplot 0)
    (SETQ msg (STRCAT msg "\nHideplot is OFF"))
    (SETQ msg (STRCAT msg "\nHideplot is ON"))
  )
  (cond
    ((or(eq(getvar"lunits")1)(eq(getvar"lunits")5))
      (setq vpsclstr (strcat "1/" (rtos (+ vpscl 0.05) 2 0) "XP"))
      (SETQ msg (STRCAT msg "\nScale: 1:" (rtos vpscl 2 (if (eq (rem vpscl 1) 0)0 8)) " (1:"(rtos vpscl 2 (if (eq (rem vpscl 1) 0)0 8))")"))
      )
    ((eq(getvar"lunits")2)
      (setq vpsclstr (strcat "1/" (rtos (+ vpscl 0.05) 2 0) "XP"))
      (SETQ msg (STRCAT msg "\nScale: 1\"=" (rtos vpscl 2 (if (eq (rem vpscl 1) 0)0 8))"' (1:"(rtos vpscl 2 (if (eq (rem vpscl 1) 0)0 8))")"))
      )
    ((eq(getvar"lunits")3)
      (setq vpsclstr (strcat "1/" (rtos (+ vpscl 0.05) 2 0) "XP"))
      (SETQ msg (STRCAT msg "\nScale: 1\"=" (rtos (/ vpscl 12) 2 (if (eq (rem vpscl 1) 0)0 8))"' (1:"(rtos vpscl 2 (if (eq (rem vpscl 1) 0)0 8))")"))
      )
    ((eq(getvar"lunits")4)
      (setq vpsclstr (strcat "1/" (rtos (+ vpscl 0.05) 2 0) "XP"))
      (SETQ msg (STRCAT msg "\nScale: " (rtos (/ 12.0000 vpscl)4 6)"=1'-0\" (1:"(rtos vpscl 2 (if (eq (rem vpscl 1) 0)0 8))")"))
      )
  )
  (SETQ msg (STRCAT msg "\nLayer: "(cdr(assoc 8 cvpent)) "\nVIEWTWIST = "(angtos(getvar"viewtwist")0 4)))
  (ALERT msg)
;;;  (setq chgvph (ukword 1 "Yes No"
;;;                 (if (= hvplot 0)
;;;                   "Turn Hideplot ON in current viewport?"
;;;                   "Turn Hideplot OFF in current viewport?"
;;;                 )
;;;                 (if (= hvplot 0)
;;;                   "Yes"
;;;                   "No"
;;;                 )
;;;               )
;;;  )
;;;  (if (= chgvph "Yes")
;;;    (if (= hvplot 0)
;;;      (command "mview" "h" "ON" (ssname cvpss 0) "")
;;;      (command "mview" "h" "OFF" (ssname cvpss 0) "")
;;;    )
;;;  )
  (princ)
)
